<template>
	<view class="Sm">
		<view class="message_top">
			<view class="message_top_title" :style="{top:computedTop}">店员管理</view>
			<view class="message_top_back" :style="{top:computedTop}" @click="Back">
				<image src="../../static/search/back.png" class="bfbimages"></image>
			</view>
		</view>
		
		<view class="message_body">
			<view class="message_body_inp" @click="Cax">
				<u--input placeholder="请输入用户ID/昵称/手机号" prefixIcon="search" prefixIconStyle="font-size: 14px;color: #999999"
					shape="circle" border="none" @confirm='confirm' v-model="input" :disabled='true' disabledColor='#FFFFFF'></u--input>
				<view class="message_body_btn">搜索</view>
			</view>
		</view>
		
		<!-- <view class="Sm_No"></view> -->
		
		
		<view class="Sm_list"  v-for="(item,index) in ForList" :key="index">
			<view>
				<view class="flex">
					<image :src="item.avatar" class="bfbimages"></image>
				</view>
				<view>
					<text>{{item.nickname}}</text><br />
					<text style="color: #999999;font-size: 26rpx;">ID：{{item.id}}</text>
				</view>
			</view>
			<view @click="CQ(item)">取消店员</view>
		</view>
		
		<view class="NoList">没有更多啦~</view>
		
		<view style="width: 100%;height: 250rpx;"></view>
		<view class="Sm_btn" @click="Cax">
			<text>+</text>
			<text style="display: inline-block;margin-left: 15rpx;">添加店员</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuButtonInfo: null,
				input:'',
				ForList:''
			}
		},
		computed: {
			computedTop() {
				if (this.menuButtonInfo) {
					return `${this.menuButtonInfo.height * 2 - 6}px`;
				}
				return '0px';
			},
		},
		onLoad() {
			const info = uni.getMenuButtonBoundingClientRect();
			this.menuButtonInfo = info;
		},
		onShow() {
			this.Apidx()
		},
		methods: {
			CQ(item){
				let data={
					staff_id:item.id
				}
				this.$request('/api/user/delStaff',data).then((res)=>{
					console.log(res,'取消');
					if(res.code==1){
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 1500
						});
						this.Apidx()
					}else{
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
						return false
					}
				})
			},
			Apidx(){
				this.$request('/api/user/staffItem').then((res)=>{
					console.log(res.data,'店员列表');
					this.ForList=res.data
				})
			},
			Cax(){
				uni.navigateTo({
					url:'/pages/Sm/SmQuery'
				})
			},
			confirm(){
				console.log(this.input);
			},
			Back() {
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss">
	.Sm {
		width: 100vw;
		min-height: 100vh;
		background-color: #F6F8FB;

		.message_top {
			width: 100%;
			height: 200rpx;
			position: relative;

			.message_top_title {
				width: 100%;
				text-align: center;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				font-size: 36rpx;
				color: #333333;
				position: absolute;
				left: 0;
				z-index: 2;
			}

			.message_top_back {
				width: 44rpx;
				height: 44rpx;
				position: absolute;
				left: 30rpx;
				z-index: 9;
			}
		}
		
		.message_body {
			width: 100%;
			height: 100rpx;
			background: #FFFFFF;
			border-radius: 50rpx;
			display: flex;
			align-items: center;
			justify-content: center;
		
			.message_body_inp {
				width: 670rpx;
				height: 80rpx;
				background: #FFFFFF;
				border-radius: 50rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding-left: 10rpx;
				padding-right: 10rpx;
			}
		
			.message_body_btn {
				width: 116rpx;
				height: 64rpx;
				background: linear-gradient(270deg, #FE4624 0%, #FF8143 100%);
				border-radius: 40rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #FFFFFF;
				text-align: center;
				line-height: 64rpx;
			}
			
	
		}
		
		.Sm_No{
			width: 540rpx;
			height: 540rpx;
			background-color: green;
			margin: 100rpx auto 0;
		}
		
		.Sm_list{
			width: 670rpx;
			height: 116rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 3rpx 25rpx 0rpx rgba(88,64,64,0.09);
			border-radius: 20rpx;
			margin: 20rpx auto 0;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding-left: 20rpx;
			padding-right: 20rpx;
		}
		.Sm_list>view:nth-child(1){
			width: 60%;
			height: 64rpx;
			display: flex;
			align-items: center;
		}
		.Sm_list>view:nth-child(1)>view:nth-child(1){
			width: 64rpx;
			height: 64rpx;
			border-radius: 50%;
			overflow: hidden;
			background-color: #eeeeee;
			margin-right: 18rpx;
		}
		.Sm_list>view:nth-child(1)>view:nth-child(2){
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 30rpx;
			color: #333333;
		}
		.Sm_list>view:nth-child(2){
			width: 144rpx;
			height: 52rpx;
			border-radius: 48rpx;
			border: 2rpx solid #FE4825;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #FE4724;
			text-align: center;
			line-height: 52rpx;
		}
		
		.Sm_btn{
			width: 710rpx;
			height: 100rpx;
			background: linear-gradient( 270deg, #FE4624 0%, #FF8143 100%);
			border-radius: 50rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #FFFFFF;
			text-align: center;
			display: flex;
			align-items: center;
			justify-content: center;
			position: fixed;
			left: 50%;
			bottom: 25rpx;
			transform: translate(-50%,0);
			z-index: 9;
		}
	}
</style>